<template>
    <div>
        <Address name="edit" :addressInfo="addressInfo" />
    </div>
</template>

<script>
import { mapState } from 'vuex'
import Address from './components/Address.vue'
export default {
    data() {
        return {
            addressInfo: {}
        }
    },
    components: {
        Address
    },
    computed: {
        ...mapState(['addressList'])
    },
    created() {
        console.log(this.$route.params.id)
        // 获取addressList,通过传过来的id在addressList中筛选出那条地址数据
        this.addressInfo = this.addressList.find(item => item.id == this.$route.params.id)
    }
}
</script>